package com.crm.entity;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "supplier")
public class Supplier implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(generator="increment")
	@GenericGenerator(name="increment", strategy = "increment")
	private int id;
	
	@Column(name="name")
	private String name;
	
	@Column(name="website")
	private String website;
	
	
	@Column(name="email")
	private String email;
	
	@Column(name="fax")
	private String fax;
	
	@Column(name="phone")
	private String phone;
	
	@Column(name="address")
	private String address;
	
	@Column(name="is_deleted")
	private boolean is_deleted;
	
	@ManyToOne
	@JoinColumn(name="BUSINESS_ID")
	private Business businessId;
	
	public Business getBusinessId() {
		return businessId;
	}
	public void setBusinessId(Business businessId) {
		this.businessId = businessId;
	}
	public Supplier(){
		super();
	}
	public Supplier(Business businessId,String name, String website, String email, String fax,
			String phone, String address, String divisions,boolean is_deleted)
			 {
		super();
		this.businessId=businessId;
		this.name = name;
		this.website = website;
		this.email = email;
		this.fax = fax;
		this.phone = phone;
		this.address = address;
		this.is_deleted=is_deleted;
	}
	
	
	@OneToMany(cascade = CascadeType.ALL)

	@JoinColumn(name = "supplierid", referencedColumnName = "id")
	private Set<SupplierUser> suppuser = new HashSet<SupplierUser>();
	
	
	public Set<SupplierUser> getSuppuser() {
		return suppuser;
	}
	public void setSuppuser(Set<SupplierUser> suppuser) {
		this.suppuser = suppuser;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getWebsite() {
		return website;
	}
	public void setWebsite(String website) {
		this.website = website;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getFax() {
		return fax;
	}
	public void setFax(String fax) {
		this.fax = fax;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}

	public boolean isIs_deleted() {
		return is_deleted;
	}
	public void setIs_deleted(boolean is_deleted) {
		this.is_deleted = is_deleted;
	}
	
	

}
